import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { HttpClient, HttpParams } from "@angular/common/http";
import {Base} from '../../common/base.js';
import { StatisDetailPage } from "../statis-detail/statis-detail";

/**
 * Generated class for the NewStaticsPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-new-statics',
  templateUrl: 'new-statics.html',
})
export class NewStaticsPage {

  trapStatic = 0;
  dryStatic = 0;
  eneStatic = 0;
  deadStatic = 0;
  medStatic = 0
  trackStatic = 0;
  cleanStatiArr = [];

  DisplayArr = [];

  constructor(public navCtrl: NavController, public navParams: NavParams,
    private httpClient: HttpClient,private base:Base) {
  }

  ionViewDidLoad() {
    this.httpClient.post(this.base.BASE_URL + "app/everydayNum",{},{
      headers: { token: localStorage['token'] },
    }).subscribe((res:any)=>{
      console.log(res);
      this.DisplayArr.push(
        {"workNum":res.trap,"mod":"诱捕器管理"},
        {"workNum":res.dry,"mod":"注干剂管理"},
        {"workNum":res.ene,"mod":"天敌防治管理"},
        {"workNum":res.dead,"mod":"枯死树管理"},
        {"workNum":res.med,"mod":"药剂防治管理"},
        {"workNum":res.track,"mod":"轨迹追踪管理"});
    },msg=>{
      console.log(msg);
    })


  }

  showDetail(mod){
    console.log(mod);
    this.navCtrl.push(StatisDetailPage,{
      module: mod
    });
  }

}